<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
</head>

<body>
	<script>
		// 只调用一次
		// window.navigator.geolocation.getCurrentPosition(success, error);

		function success(res) {
			console.log(res)
		}

		function error(err) {
			console.log(err)
		}


            //   实时获取用户地理位置
		window.navigator.geolocation.watchPosition(success,error)


	</script>
</body>

</html>